{extend name="Base/base"/}
{block name="body"}
    <div class="main-title">
        <h2>
            新增订单
        </h2>
    </div>

<div class="with-padding">


    <div class="tab-wrap" style="margin-bottom: 5px">
        <ul class="nav nav-secondary group_nav">
        </ul>
    </div>
    {notempty name="list"}
    <form action="{:url(request()->action(),array('action'=>'add'))}" method="post" class="form-horizontal">
        <label class="item-label">订单编号    </label>
        <div class="controls ">
            <input type="text" name="id" value="{$list.id}" class="text input-large form-control" style="width:400px"
                   readonly="">
            <p class="lead"></p>
        </div>
        <label class="item-label">商品名称    </label>
        <div class="controls ">
            <input type="text" name="product_name" value="{$list.product_name}" class="text input-large form-control" style="width:
            400px"></div>
        <label class="item-label">商品金额    </label>
        <div class="controls ">
            <input type="text" name="product_price" value="{$list.product_price}" class="text input-large form-control" style="width:
            400px"></div>
        <label class="item-label">用户昵称    </label>
        <div class="controls ">
            <input type="text" name="buyer_nick" value="{$list.buyer_nick}" class="text input-large form-control" style="width:
            400px"></div>
         <label class="item-label">用户手机    </label>
        <div class="controls ">
            <input type="text" name="receiver_mobile" value="{$list.receiver_mobile}" class="text input-large form-control" style="width:
            400px"></div>

        <label class="item-label">订单状态    </label>
        <div class="controls ">

            <label for="id_stauts_0"><input id="id_stauts_0" name="order_status" value="0" type="radio" {if
                                            condition="$list['order_status'] eq 0"}checked=""{/if}>待付款</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label for="id_stauts_1"> <input id="id_stauts_1" name="order_status" value="1" type="radio" {if
                                             condition="$list['order_status'] eq 1"}checked=""{/if}>已付款</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label for="id_stauts_0"><input id="id_stauts_0" name="order_status" value="2" type="radio" {if
                                            condition="$list['order_status'] eq 2"}checked=""{/if}>待退款</label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label for="id_stauts_1"> <input id="id_stauts_1" name="order_status" value="3" type="radio" {if
                                             condition="$list['order_status'] eq 3"}checked=""{/if}>已退款</label>&nbsp;&nbsp;&nbsp;&nbsp;

        </div>
        <label class="item-label">创建时间    </label>
        <div class="controls ">
            <input type="hidden" name="order_create_time" value="{$list.order_create_time}">
            <input type="text" id="datetimepicker" data-field-name="order_create_time"
                   class="text input-large form-datetime time form-control" style="width: 400px"
                   value="{$list.order_create_time}">
        </div>
        <br>

        <div class="form-item">
            <button class="btn  ajax-post btn-success" id="submit" type="submit" target-form="form-horizontal">确定
            </button>  &nbsp;<button onclick="javascript:history.back(-1);return false;" class="btn btn-return">返回</button>  &nbsp;            </div>
    </form>
    {else/}
    <form action="{:url(request()->action(),array('action'=>'add'))}" method="post" class="form-horizontal">
        <label class="item-label">订单编号    </label>
        <div class="controls ">
            <input type="hidden" name="id" value="" class="text input-large form-control" style="width:400px" placeholder="无需填写" readonly="">
            <p class="lead"></p>
        </div>
        <label class="item-label">商品名称    </label>
        <div class="controls ">
            <input type="text" name="product_name" value="" class="text input-large form-control" style="width:
            400px"></div>
        <label class="item-label">商品金额    </label>
        <div class="controls ">
            <input type="text" name="product_price" value="" class="text input-large form-control" style="width:
            400px"></div>
        <label class="item-label">用户昵称    </label>
        <div class="controls ">
            <input type="text" name="buyer_nick" value="" class="text input-large form-control" style="width:
            400px"></div>
         <label class="item-label">用户手机    </label>
        <div class="controls ">
            <input type="text" name="receiver_mobile" value="" class="text input-large form-control" style="width:
            400px"></div>

        <label class="item-label">订单状态    </label>
        <div class="controls ">
            <label for="id_stauts_0"><input id="id_stauts_0" name="order_status" value="0" type="radio" checked="">待付款
            </label>&nbsp;&nbsp;&nbsp;&nbsp;
            <label for="id_stauts_1"> <input id="id_stauts_1" name="order_status" value="1" type="radio">已付款</label>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <label for="id_stauts_0"><input id="id_stauts_0" name="order_status" value="2" type="radio">待退款</label>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <label for="id_stauts_1"> <input id="id_stauts_1" name="order_status" value="3" type="radio">已退款</label>
            &nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <label class="item-label">创建时间    </label>
        <div class="controls ">
            <input type="hidden" name="order_create_time" value="">
            <input type="text" id="datetimepicker" data-field-name="order_create_time"
                   class="text input-large form-datetime time form-control" style="width: 400px"
                   value="<?php echo time_format(time())?>"
                   placeholder="请选择时间">
        </div>
        <br>

        <div class="form-item">
            <button class="btn  ajax-post btn-success" id="submit" type="submit" target-form="form-horizontal">确定
            </button>  &nbsp;<button onclick="javascript:history.back(-1);return false;" class="btn btn-return">返回</button>  &nbsp;            </div>
    </form>
    {/notempty}
</div>
{/block}

{block name="script"}
    <script type="text/javascript">
        $('.form-datetime').datetimepicker({
            language: "zh-CN",
            autoclose: true,
            format: 'yyyy-mm-dd hh:ii'
        });
        $('.form-date').datetimepicker({
            language: "zh-CN",
            minView: 2,
            autoclose: true,
            format: 'yyyy-mm-dd'
        });
        $('.form-time').datetimepicker({
            language: "zh-CN",
            minView: 0,
            startView:1,
            autoclose: true,
            format: 'hh:ii'
        });
        $('.time').change(function () {
            var fieldName = $(this).attr('data-field-name');
            var dateString = $(this).val();
            var date = new Date(dateString);
            var timestamp = date.getTime();
            $('[name=' + fieldName + ']').val(Math.floor(timestamp / 1000));
        });

        $(function () {
            //搜索功能
            $("#search").click(function () {
                var url = $(this).attr('url');
                var query = $('.search-form').find('input').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
                window.location.href = url;
            });
            //回车搜索
            $(".search-input").keyup(function (e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });
            //导航高亮

            //点击排序
            $('.list_sort').click(function () {
                var url = $(this).attr('url');
                var ids = $('.ids:checked');
                var param = '';
                if (ids.length > 0) {
                    var str = new Array();
                    ids.each(function () {
                        str.push($(this).val());
                    });
                    param = str.join(',');
                }

                if (url != undefined && url != '') {
                    window.location.href = url + '/ids/' + param;
                }
            });
        });
    </script>
{/block}